#include "process.h"
#include <string.h>
#include <unistd.h>

#define NUM 101
#define STYLE '='


// verison2
void FlushProcess(double total, double current)
{
  char buffer[NUM];
  memset(buffer,0,sizeof(buffer));
  int i=0;
  const char *lable="|/-\\";
  int len=strlen(lable);
  int num=(int)(current*100/total);
for(;i<num;i++){
  buffer[i] = STYLE;


}
int cnt=0;
double rate =current*100/total;
printf("[%-100s][%.1f%%][%c]\r", buffer, rate, lable[cnt]);
cnt++;
fflush(stdout);
}


